package com.xxwu.springblogsystem.config;

import com.xxwu.springblogsystem.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@ControllerAdvice
@ResponseBody
public class ErrorHandler {
    @ExceptionHandler(Exception.class)
    public Result exceptionAdvice(Exception e) {
        return Result.fail(e.getMessage(), -1);
    }
}
